package gen_b2g.game.bean;

import java.io.*;
import java.util.*;

import com.bowlong.util.*;

@SuppressWarnings({ "rawtypes", "unchecked" })
public class NIdOrKeys extends com.bowlong.net.proto.N3Support {
    public static final int _CID = 53982688;

    public List<NIdOrKey> idOrKeys = new NewList(); 

    public NIdOrKeys setNIdOrKeys(List idOrKeys){
        this.idOrKeys = idOrKeys;
        return this;
    }

    public NIdOrKeys(){}

    public NIdOrKeys(List idOrKeys){
        this.idOrKeys = idOrKeys;
    }

    public NIdOrKeys(NewMap map2) {
        this.idOrKeys = maps_idOrKeys( map2.getList(-763134094) );
    }

    public List<Map> idOrKeys_maps() {
        List<Map> r = new NewList<Map>();
        if(idOrKeys == null) return r;
        for(NIdOrKey _e : idOrKeys) {
            Map e = _e.toMap();
            if(e == null) continue;
            r.add(e);
        }
        return r;
    }

    public static List<NIdOrKey> maps_idOrKeys(List<Map> maps) {
        List r = new NewList();
        for(Map _e : maps) {
            NewMap _map = NewMap.create(_e);
            NIdOrKey e = NIdOrKey.parse(_map);
            if(e == null) continue;
            r.add(e);
        }
        return r;
    }


    public Map _cacheResult;
    public Map toMap() {
        if(_cacheResult != null && !_cacheResult.isEmpty())
           return _cacheResult;
        Map r = new HashMap();
        r.put(-1, _CID);
        r.put(-763134094, idOrKeys_maps());
        return r;
    }


    public static NIdOrKeys parse(NewMap map2) {
        NIdOrKeys r = new NIdOrKeys(map2);
        return r;
    }


    public static NIdOrKeys parse(NewMap map2, NIdOrKeys r) {
        if(map2 == null) return null;

        r.idOrKeys = maps_idOrKeys( map2.getList(-763134094) );
        return r;
    }

    public String toString() {
        return "NIdOrKeys[idOrKeys=" + idOrKeys + "]";
    }

    public static NIdOrKeys parse(byte[] buf) throws Exception {
        Map<Object, Object> map = com.bowlong.bio3.B3Helper.parseMap(buf);
        NewMap map2 = NewMap.create(map);
        return parse(map2);
    }

    public static NIdOrKeys parse(InputStream in) throws Exception {
        Map<Object, Object> map = com.bowlong.bio3.B3Helper.parseMap(in);
        NewMap map2 = NewMap.create(map);
        return parse(map2);
    }

    public byte[] toByteArray() throws Exception {
        return com.bowlong.bio3.B3Helper.toBytes(toMap());
    }

}
